//
//  LBShareKeyModel.m
//  share
//
//  Created by 杨庆人 on 17/4/7.
//  Copyright © 2017年 杨庆人. All rights reserved.
//

#import "LBShareKeyModel.h"
#import <MJExtension/MJExtension.h>
#import <UMSocialCore/UMSocialCore.h>
@implementation LBChannelModel
- (instancetype)init {
    if (self = [super init]) {
        /** 友盟设置参数不能为nil */
        self.appKey = @"";
        self.appSecret = @"";
        self.redirectURL = @"";
        self.platformType = UMSocialPlatformType_UnKnown;
        self.name = @"";
    }
    return self;
}
@end

@implementation LBShareKeyModel

+ (void)initialize
{
    [LBShareKeyModel mj_setupObjectClassInArray:^NSDictionary *{
        return @{
                 @"channelArray":@"LBChannelModel"
                 };
    }];
}

- (instancetype)init {
    if (self = [super init]) {
         /** 友盟设置参数不能为nil */
        self.UMSocialKey = @"";
        self.shareTitle = @"";
        self.shareSubTitle = @"";
        self.shareURL = @"";
    }
    return self;
}
- (void)setShareURL:(NSString *)shareURL {
    if ([shareURL containsString:@"?"]) {
        _shareURL = [NSString stringWithFormat:@"%@&source=ios",shareURL];
    }
    else {
        _shareURL = [NSString stringWithFormat:@"%@?source=ios",shareURL];
    }
}

- (void)cleanUnKnowData {
    
    NSMutableArray * removeArray = [[NSMutableArray alloc] init];
    
    for (LBChannelModel * model in self.channelArray) {
        
        if (model.platformType == UMSocialPlatformType_UnKnown) {
            
            [removeArray addObject:model];
        }
    }
    
    for (LBChannelModel * model in removeArray) {
        [self.channelArray removeObject:model];
    }
}



@end
